{% extends 'base.html' %}
{% load highlight %}
{% load comments %}

{% block style %}
    <style>
        .highlighted {
            color: red;
        }
    </style>
{% endblock style %}
{% block title %}搜索结果{% endblock title %}
{% block main %}
    <main class="unit-3-4 unit-1-on-mobile">
        <section class="bg-white list-group post-items top-gap">
            {% if query %}
                {% for result in page.object_list %}
                    {% include 'search/_search_post_item.html' with post=result.object %}
                {% empty %}
                    <div class="list-group-item no-post text-center">没有搜索到你想要的结果！</div>
                {% endfor %}
                {% if page.has_previous or page.has_next %}
                    <div class="list-group-item">
                        {% if page.has_previous %}
                            <a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo;
                        上一页
                        {% if page.has_previous %}</a>{% endif %}
                        |
                        {% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}
                        下一页
                        &raquo;{% if page.has_next %}</a>{% endif %}
                    </div>
                {% endif %}
            {% else %}
                <div class="list-group-item no-post text-center">请输入搜索关键词，例如 django</div>
            {% endif %}
        </section>
    </main>
{% endblock main %}